﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Plan : System.Web.UI.Page
{
    Connectdbnour con = new Connectdbnour();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        con.tasdeedmnelplan(DropDownList9.SelectedItem.ToString(), Convert.ToInt16(DropDownList10.SelectedItem.ToString()));
        Response.Redirect("Plan.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (DropDownList2.SelectedItem.ToString() == "Check")
        {
            con.insertplan(DropDownList1.SelectedItem.ToString(), DropDownList2.SelectedItem.ToString(), DropDownList3.SelectedItem.ToString() + "-" + DropDownList5.SelectedItem.ToString() + "-" + DropDownList4.SelectedItem.ToString(), TextBox1.Text, Convert.ToDouble(TextBox2.Text), TextBox3.Text, Convert.ToInt16(DropDownList6.SelectedItem.ToString()));
        }
        else if (DropDownList2.SelectedItem.ToString() == "Cash")
        {
            con.insertplan(DropDownList1.SelectedItem.ToString(), DropDownList2.SelectedItem.ToString(), DropDownList3.SelectedItem.ToString() + "-" + DropDownList5.SelectedItem.ToString() + "-" + DropDownList4.SelectedItem.ToString(), "null", Convert.ToDouble(TextBox2.Text), "null", Convert.ToInt16(DropDownList6.SelectedItem.ToString()));
        }
        Response.Redirect("Plan.aspx");
    }

    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList2.SelectedItem.ToString() == "Cash")
        {
            TextBox1.Enabled = false;
            TextBox3.Enabled = false;
        }
        else if (DropDownList2.SelectedItem.ToString() == "Check")
        {
            TextBox1.Enabled = true;
            TextBox3.Enabled = true;
        }
    }
}